public class Score {
    private Student student; // 关联学生对象
    private Course course;   // 关联课程对象
    private double score;    // 分数

    // 构造方法：关联学生和课程，同时校验分数
    public Score(Student student, Course course, double score) throws ScoreOutOfRangeException {
        this.student = student;
        this.course = course;
        // 分数校验：超出0-100则抛异常
        if (score < 0 || score > 100) {
            throw new ScoreOutOfRangeException("分数必须在0-100之间");
        }
        this.score = score;
    }

    // getter方法：获取关联对象和分数
    public Student getStudent() {
        return student;
    }

    public Course getCourse() {
        return course;
    }

    public double getScore() {
        return score;
    }
}